package router

import (
	"ferry/apis/points"
	"ferry/middleware"
	jwt "ferry/pkg/jwtauth"

	"github.com/gin-gonic/gin"
)

/*
  @Author : lanyulei
  @Desc : 积分相关路由
*/

func RegisterPointsRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
	PointsRouter := v1.Group("points").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
	{
		// 添加用户积分
		PointsRouter.POST("/add", points.AddPoints)
		// 获取用户积分信息
		PointsRouter.GET("/user", points.GetUserPoints)
		// 获取用户积分历史
		PointsRouter.GET("/history", points.GetPointsHistory)
		// 获取积分排行榜
		PointsRouter.GET("/ranking", points.GetPointsRanking)
		// 获取可兑换商品列表
		PointsRouter.GET("/exchange/goods", points.GetExchangeGoods)
		// 兑换商品
		PointsRouter.POST("/exchange", points.ExchangeGoods)
	}
}
